<?php 
$currentPageLocation = "/dispatcher.php?controller=Commerce/ListCategories";
$category = pc_variable("commerce.category");
if($category !== null) { 
    $currentPageLocation = "/dispatcher.php?controller=Commerce/GetCategory&categoryId=" . $category->getId();
} else if(pc_variable("commerce.articles") !== null) {
    $currentPageLocation = "/dispatcher.php?controller=Commerce/FindArticles&term=" . pc_encode_url(pc_variable("term"));
}
pc_set("currentPage.location", $currentPageLocation);